﻿<UserControl x:Class="ThreadSync.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit" 
    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
    xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
    xmlns:my="clr-namespace:ThreadSync"
    mc:Ignorable="d" Height="148" Width="319">

    <UserControl.Resources>
        <my:MainViewModel x:Key="vm"/>
    </UserControl.Resources>
    
    <Canvas x:Name="LayoutRoot" Background="White"
            DataContext="{StaticResource vm}">
        <TextBlock Canvas.Left="21" Canvas.Top="29" Height="28" Name="label1" Width="68" Text="Iterations:" />
        <toolkit:NumericUpDown Canvas.Left="95" Canvas.Top="33" Height="22" Name="valueNumericUpDown" Value="{Binding Path=Iterations, Mode=TwoWay}" Width="60" />
        <Button Canvas.Left="170" Canvas.Top="33" Content="Go" Height="23" Name="goButton" Width="42" IsEnabled="{Binding CanWork}">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="Click">
                    <ei:CallMethodAction 
                TargetObject="{Binding}"
                MethodName="DoWork"/>
                </i:EventTrigger>
            </i:Interaction.Triggers>
        </Button>
        <TextBlock Canvas.Left="95" Canvas.Top="104" Height="23" Name="resultTextBox" Width="60" FontWeight="Bold" Text="{Binding Path=Result}" />
        <TextBlock Canvas.Left="21" Canvas.Top="66" Height="28" Name="label2" Width="68" Text="Max:" />
        <TextBox Canvas.Left="95" Canvas.Top="68" Height="23" Name="maxTextBox" Width="60" Text="{Binding Path=Max, Mode=TwoWay}" />
        <TextBlock Canvas.Left="21" Canvas.Top="102" Height="28" Name="label3" Width="68" Text="Result:" />
    </Canvas>
</UserControl>
